<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/add.css"/>
	</head>
	<body>
		<div id="app">
			<div class="header">
				<span>添加快递员</span>
			</div>
			<div class="content">
				<table>
					<tr>
						<td class="text-right">姓名</td><td class="content_right"><input class="input" placeholder="请输入姓名" id="userName"></td>
					</tr>
					<tr>
						<td class="text-right">手机号码</td><td class="content_right"><input class="input" placeholder="请输入手机号码" id="phone"></td>
					</tr>
					<tr>
						<td class="text-right">身份证号码</td><td class="content_right"><input class="input" placeholder="请输入身份证号码" id="idNumber"></td>
					</tr>
					<tr>
						<td class="text-right">密码</td><td class="content_right"><input class="input" placeholder="请输入密码" id="password"></td>
					</tr>
					<tr>
						<td></td><td class="content_right"><span class="btn btn-info" id="submit">立即提交</span> <span class="btn">重置</span> </td>
					</tr>
				</table>
				
				
			</div>
		</div>
	</body>
	<script src="/qrcode/jquery2.1.4.js"></script>
	<script src="/layer/layer.js"></script>
	<script>
		$(function () {
			$("#submit").click(function () {
				var windowId = layer.load(1);
				var userName = $("#userName").val();
				var phone = $("#phone").val();
				var idNumber = $("#idNumber").val();
				var password = $("#password").val();
				if (userName.length == 0 || phone.length == 0 || idNumber.length == 0 || password.length == 0) {
					layer.msg("请输入完整的信息再提交！");
					return false;
				}
				var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
				if (!phoneReg.test(phone)) {
					layer.msg(" 请输入有效的手机号码！");
					return false;
				}
				// if (idNumber.length != 15 || idNumber.length != 18) {
				// 	layer.msg("请输入正确的身份证号码！");
				// 	return false;
				// }
				$.getJSON("/courier/add.do",{
					userName:userName,
					phone:phone,
					idNumber:idNumber,
					password:password
				},function (data) {
					layer.close(windowId);
					layer.msg(data.result);
					if (data.status == 0) {
						$("input").val("");
					}
				});
			});
		})
	</script>
</html>
